package com.zhiyou.mall.service;


import com.zhiyou.mall.mapper.SGoodsDetailMapper;
import com.zhiyou.mall.mapper.SGoodsMapper;
import com.zhiyou.mall.model.SGoods;
import com.zhiyou.mall.model.SGoodsDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * @author by zhouyanchao
 * Created on 2017/11/4.
 * Descr:
 */

@Service
public class AdminGoodsImpl implements IAdminGoodsService {

	@Autowired
	SGoodsMapper goodsMapper;

	@Autowired
	SGoodsDetailMapper goodsDetailMapper;

	@Override
	public List<SGoods> queryAllGoods() {
		return goodsMapper.selectAll();
	}

	@Override
	public SGoods queryGoodsById(int id) {
		return goodsMapper.selectByPrimaryKey(id);
	}

	@Override
	public SGoodsDetail queryGoodsDetailByGoodsUuid(String uuid) {
		return goodsDetailMapper.queryGoodsDetailByUuid(uuid);
	}

	@Override
	public boolean insertGoodsDetail(SGoodsDetail detail) {

		goodsDetailMapper.insert(detail);

		return false;
	}

	@Override
	public boolean updateGoodsDetail(SGoodsDetail detail) {

		goodsDetailMapper.updateByPrimaryKey(detail);
		return false;
	}

}
